package com.lzhsite.leetcode.algoritom.practise;
import java.util.BitSet;

public class BitMap {
 
	
	// 1M=8*1024*1024位
	// 1,000,000,000所需要的内存空间为1,000,000,000/(8*1024*1024)=120M
	// 1 int 32位 使用位图发需要的空间为120M/32=3.75M
	public static void main(String[] args) {
		int count = 1000000000;
		BitSet bit = new BitSet(count);
		int maxnum = 10000;
		while (maxnum > 0) {
			bit.set((int) (Math.random() * maxnum)+1);
			maxnum--;
		}

		for (int index = 0; index < count; index++) {
			if (bit.get(index)) {
				System.out.print(index + ",");
			}
		}
	}
	
 
}
